package the.broccoli.et.interfaces.dto;

import lombok.Data;
import org.springframework.beans.BeanUtils;
import the.broccoli.et.infrastructure.persistent.model.EventTrigger;

import java.time.LocalDateTime;

/**
 * @author lei.liu
 * @date 2021/7/20
 */
@Data
public class EventTriggerSavingDTO {
    private String userId;
    private Integer eventType;
    private String eventCode;
    private String eventName;
    private String bizData;

    public EventTrigger toEventTrigger() {
        EventTrigger eventTrigger = new EventTrigger();
        BeanUtils.copyProperties(this, eventTrigger);
        eventTrigger.setTriggerTime(LocalDateTime.now());
        return eventTrigger;
    }

}
